# -*- coding: utf-8 -*-

class AdminMakersController < AdminController
  def index
    @makers = Maker.order(:name_yomi).all
  end
  
  def input_add
    @maker = Maker.new
    @latitude = 37.0
    @longtitude = 138.0
    @zoom = 5

    render :template => "/admin_makers/input_update"
  end
  
  def input_edit
    puts params
    @maker = Maker.find(params[:id])
    @latitude = @maker.latitude
    @longtitude = @maker.longtitude
    @zoom = 10

    render :template => "/admin_makers/input_update"
  end
  
  def update
    @maker = params[:maker][:id].blank? ? Maker.new : Maker.find(params[:maker][:id])
    @maker.update_attributes(params[:maker])
    @maker.save!
    
    redirect_to :action => :index
  end
  
  def change_show
    @maker = Maker.find(params[:id])
    @maker.is_show = @maker.is_show ? false : true
    @maker.save!
    
    redirect_to :action => :index
  end
end
